{% load blog_tags %}
{% load static %}
<!DOCTYPE html>
<html>
 <head>
 <!-- 将可能变化的标题变为可替换的标题块 -->
 <title>>{% block title %}{% endblock %}</title>
 <!-- 加载静态资源blog.css -->
 <link href="{% static 'css/blog.css' %}" rel="stylesheet">
 </head>
 <body>
 <!-- 将可能变化的内容变为可替换的内容块，并添加id-->
 <div id="content">
 {% block content %}
 {% endblock %}
 </div>
 <!-- 增加侧边栏块 -->
 <div id="sidebar">
 <h2>My blog</h2>
 <p>This is my blog. I've written {% total_posts %} posts so far.</p>
 <h3>Latest posts</h3>
 {% show_latest_posts %}
 <h3>Most commented posts</h3>
<!-- 使用get_most_commented_posts 标签获取评论最多标签保存到变量
most_commented_posts中-->
{% get_most_commented_posts as most_commented_posts %}
<ul>
<!-- 对于每一个评论最多的文章 -->
 {% for post in most_commented_posts %}
 <li>
 <!-- 显示文章标题并转为超链接 -->
 <a href="{{post.get_absolute_url}}">{{post.title}}</a>
 </li>
 {% endfor %}
</ul>
 </div>
 </body>
</html>
